package cn.tedu.review;


import java.util.ArrayList;
import java.util.List;

/**本类用于回顾泛型*/
public class TestGeneric {
    public static void main(String[] args) {
        List c = new ArrayList();
        c.add("张三");
        c.add(3);
        c.add('男');
        c.add(10000.9);
        System.out.println(c);//集合c重写了Object中tostring方法

        List <Integer> c2 = new ArrayList();
        c2.add(100);
        c2.add(200);
        c2.add(300);
        c2.add(400);
        System.out.println(c2);

        Integer[] a = {1,2,3,4,5};
        Double[] b = {1.1,2.2,3.3,4.4,5.5};
        Character[] d = {'h','e','l','l','o'};
        print(a);
        print(b);
        print(d);
    }
    private static <E> void print(E[] e){
        for (E f:e){
            System.out.println(f);
        }
    }
}
